/**
 * 
 */
package com.sesame.daoimpl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.sesame.dao.ImageDAO;
import com.sesame.domain.Image;

/**
 * @author voidman
 * 
 */
public class ImageDAOImpl extends SqlMapClientDaoSupport implements ImageDAO {

    public void addImage(Image Image) {
        getSqlMapClientTemplate().insert("addImage", Image);
    }

    public void deleteImageById(Integer id) {
        getSqlMapClientTemplate().delete("deleteImageById", id);
    }

    @SuppressWarnings("unchecked")
    public List<Image> getAllImage() {
        List<Image> listImage;
        listImage = getSqlMapClientTemplate().queryForList("getAllImage");
        return listImage;
    }
    
    public Image getImageById(Integer id) {

        return (Image) getSqlMapClientTemplate().queryForObject("getImageById", id);
    }

    public void updateImage(Image Image) {
        getSqlMapClientTemplate().update("updateImage", Image);
    }

}
